package com.tang.h2_demo.controller;

import com.tang.h2_demo.domain.OperatorLog;
import com.tang.h2_demo.domain.UserInf;
import com.tang.h2_demo.service.OperatorLogService;
import com.tang.h2_demo.service.UserInfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2021/12/23 20:50
 * @Desc
 * @Remarks
 */
@RequestMapping("/userInf")
@RestController
public class UserInfController {
    @Autowired
    private UserInfService userInfService;

    @Autowired
    private OperatorLogService operatorLogService;

    @RequestMapping("/add")
    public void add(@RequestBody @Validated UserInf userInf) {
        userInfService.save(userInf);
    }

    @RequestMapping("/delete")
    public void delete(@RequestBody @Validated UserInf userInf) {
        userInfService.delete(userInf);
    }

    @RequestMapping("/findAll")
    public List<UserInf> findAll() {
        return userInfService.findAll();
    }

    @RequestMapping("/findAllOperators")
    public List<OperatorLog> findAllOperators() {
        return operatorLogService.findAll();
    }

}
